#include <cstdio>


/**
 * 时间复杂度：O(n+m)
 * 空间复杂度：O(1)
 * 
 * 
 * 合并两个有序数组
 * @return 
 */
int main() {
	int arr1[110]{}, arr2[110]{};

	int n;
	scanf("%d", &n);

	for (int i=0; i<n; i++) {
		scanf("%d", &arr1[i]);
	}

	int m;
	scanf("%d", &m);
	for (int i=0; i<m; i++) {
		scanf("%d", &arr2[i]);
	}

	int arr3[220]{};

	int leftIndex = 0;
	int rightIndex = 0;
	int idx = 0;
	while (leftIndex < n && rightIndex < m) {
		if (arr1[leftIndex] <= arr2[rightIndex]) {
			arr3[idx] = arr1[leftIndex];
			leftIndex++;
			idx++;
		}else {
			arr3[idx] = arr2[rightIndex];
			rightIndex++;
			idx++;
		}
	}

	while(leftIndex < n) {
		arr3[idx] = arr1[leftIndex];
		leftIndex++;
		idx++;
	}

	while (rightIndex < m) {
		arr3[idx] = arr2[rightIndex];
		rightIndex++;
		idx++;
	}


	for (int i=0; i<n+m; i++) {
		printf("%d ", arr3[i]);
	}	

	return 0;
}